package com.example.flower_shop.repository;

import com.example.flower_shop.entity.MerchantOrder;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.Optional;

@Repository
public interface MerchantOrderRepository extends JpaRepository<MerchantOrder, Long> {
    Optional<MerchantOrder> findByOrderNo(String orderNo);

    Optional<MerchantOrder> findByCustomerOrderId(Long customerOrderId);

    Optional<MerchantOrder> findByOrderNoAndMerchantId(String orderNo, Long merchantId);

    Page<MerchantOrder> findByStatus(Integer status, Pageable pageable);

    Page<MerchantOrder> findByMerchantId(Long merchantId, Pageable pageable);

    Page<MerchantOrder> findByMerchantIdAndStatus(Long merchantId, Integer status, Pageable pageable);
}